<?php
// 获得当前所设置可预约项目列表
// header("content-type:text/html;charset=UTF-8");
include_once("conn.php");
include_once("a_getLoginInfo.php");

$select_depart = "SELECT * FROM department_infos ORDER BY department_ID ASC";
$result_depart = mysqli_query($connect_DB,$select_depart);
if($result_depart){
    while($row_depart = mysqli_fetch_object($result_depart)){
        $select_doc = "SELECT * FROM doc_infos WHERE doc_TypeMain = '".$row_depart->department_ID."'";
        if($result_doc = mysqli_query($connect_DB,$select_doc)){
            $doc_num = mysqli_num_rows($result_doc);
            if($doc_num <= 0){
                $link_btn = "<a href='a_DelDepartment.php?departid=".$row_depart->department_ID."'><button class='btn btn-danger btn-sm'>删 除</button></a>";
            }else{
                $link_btn = "<a href='javascript:viod(0);'><button class='btn btn-danger btn-sm' disabled>删 除</button></a>";
            }
        }else{
            echo"<div class='department-list-con'>查询医生人数失败！</div>";
            exit();
        }
        echo"
        <div class='department-list-con'>
            <div class='depart-name'>".$row_depart->department_Name."</div>
            <div class='depart-count'>".$doc_num."</div>
            <div class='depart-caozuo'>".$link_btn."</div>
        </div>";
    }
}else{
    echo "<div class='department-list-con'>查询出错</div>";
}
$connect_DB->close();
?>